home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-04
/
422mods.zip
/
JAFO15.422
< prev
next >
Wrap
Text File
|
1993-04-16
|
8KB
|
264 lines
JAFO15.MOD - The CPS Rate Display Mod
JAFO #1 @8857
Sun Apr 11 1993 20:50:04
┌────────────────────────────────────────────────────────────────────────────┐
│ Mod Name : JAFO15.MOD Mod Author: JAFO 1@1 TerraNET │
│ Difficulty : ███▒▒▒▒▒▒▒ 1@8857 IceNET │
│ WWIV Version : 4.22 1@8861 WWIVnet │
│ Mod Date : 04/11/93 1@18857 WWIVLink │
│ Files Affected: BATCH.C, XFER.C, XFEROVL.C, FCNS.H │
│ Description : The CPS Rate Display Mod │
└────────────────────────────────────────────────────────────────────────────┘
══[ Description ]═════════════════════════════════════════════════════════════
This modification gives your BBS the ability to report the cps rates to your
users for all file transfers.
Wayne actually added the ability to report cps rates for batch transfers in
WWIV v4.21a, but he only reports them to the sysop log. He does not display
the cps rates to the user.
This mod displays cps rates for regular transfers as well as batch transfers.
Everything is sent to the sysop log as well as the screen. I actually had
this code written and installed on my BBS about 3-4 months before v4.21a was
released, and as far as I know Wayne did not know I had written it. Anyway,
I just wanted to clarify that Wayne's code did not give me the idea to do
this mod!
══[ Legend ]══════════════════════════════════════════════════════════════════
= Existing line - Do not change
+ Add this line
- Remove this line
══[ Step 1 ]══════════════════════════════════════════════════════════════════
Please back up your source code. Even the best programmers make mistakes.
══[ Step 2 ]══════════════════════════════════════════════════════════════════
In BATCH.C, make the following changes in "void downloaded".
= if (cps)
= sprintf(s,get_stringx(1,50),u.filename, cps);
= else
= sprintf(s,get_stringx(1,43),u.filename);
= sysoplog(s);
+ pl(s);
= if (syscfg.sysconfig & sysconfig_log_dl) {
= sprintf(s,get_stringx(1,51),
= nam(&thisuser,usernum), u.filename, date());
= ssm(u.ownerusr,0,s);
= }
= }
══[ Step 3 ]══════════════════════════════════════════════════════════════════
In "void uploaded", make the following additions.
= sysoplog(s);
= outstr(get_string(866));
= outstr(u.filename);
= outstr(get_string(867));
- pl(directories[batch[i1].dir].name);
+ outstr(directories[batch[i1].dir].name);
+ npr(" (%ld cps)\r\n",cps);
= }
= }
= closedl();
══[ Step 4 ]══════════════════════════════════════════════════════════════════
In XFER.C, add the following to "void upload".
= farfree(ss);
= }
= nl();
= if (xfer) {
+ _chmod(dszlog,1,0);
+ unlink(dszlog);
= ti=timer();
= receive_file(s1,&ok,&u.filetype, u.filename, dn);
= ti=timer()-ti;
══[ Step 5 ]══════════════════════════════════════════════════════════════════
Still in "void upload", make the changes indicated.
= if (check_ul_event(dn,&u)) {
= if (u.mask & mask_extended)
= delete_extended_description(u.filename);
= ok=0;
= } else {
= f=open(s1,O_RDONLY | O_BINARY);
= }
- }
+ } else
+ nl();
= }
= if (ok) {
= if (ok==1) {
= l=filelength(f);
= u.numbytes=l;
══[ Step 6 ]══════════════════════════════════════════════════════════════════
Still in "void upload", do the following changes.
= if (ok==1) {
= ++status.uptoday;
= save_status();
+ process_cps(u.filename,directories[dn].name);
- sprintf(s,get_stringx(1,42),u.filename,directories[dn].name);
- sysoplog(s);
- nl();
- nl();
- pl(get_string(781));
= nl();
= outstr(get_string(782));
══[ Step 7 ]══════════════════════════════════════════════════════════════════
Add the following in "int try_to_download".
= if ((i1) || (strncmp(u.filename,"WWIV4",5)==0)) {
= sprintf(s1,"%s%s",directories[dn].path,u.filename);
= sent=0;
= abort=0;
+ _chmod(dszlog,1,0);
+ unlink(dszlog);
= if (i1==-1)
= send_file(s1,&sent,&abort,u.filetype,u.filename,dn, -2L);
= else
= send_file(s1,&sent,&abort,u.filetype,u.filename,dn, u.numbytes);
══[ Step 8 ]══════════════════════════════════════════════════════════════════
Still in "int try_to_download", make the changes indicated.
= thisuser.dk += (int) ((u.numbytes+1023)/1024);
= ++u.numdloads;
= SETREC(i);
= write(dlf,(void *)&u,sizeof(uploadsrec));
+ nl();
+ process_cps(u.filename,"");
- sprintf(s1,get_stringx(1,43),u.filename);
- sysoplog(s1);
- nl();
= nl();
= outstr(get_string(782)); npr("%-6.3f\r\n", ratio());
══[ Step 9 ]══════════════════════════════════════════════════════════════════
In XFEROVL.C, add the following two functions to the end of the file.
void handle_cps(char *l, char *s, char *s1)
{
char *ss;
int i;
long cps;
char s2[81];
/* find the filename */
ss=strtok(l," \t");
for (i=0; (i<5) && (ss); i++) {
switch(i) {
case 4: cps=atol(ss); break;
}
ss=strtok(NULL," \t");
}
if (ss) {
switch(*l) {
case 'Z':
case 'r':
case 'R':
case 'B':
case 'H':
/* received a file */
sprintf(s2,get_stringx(1,54),s,s1,cps);
sysoplog(s2);
sprintf(s2,"Uploaded '%s' (%ld cps)",s,cps);
nl();
pl(s2);
break;
case 'z':
case 's':
case 'S':
case 'b':
case 'h':
/* sent a file */
sprintf(s2,get_stringx(1,50),s,cps);
sysoplog(s2);
nl();
pl(s2);
break;
case 'E':
case 'e':
case 'L':
case 'l':
case 'U':
/* error */
sprintf(s2,get_stringx(1,60),s);
sysoplog(s2);
break;
}
}
}
void process_cps(char *s, char *s1)
{
int f,i,i1;
char *ss,*line;
f=open(dszlog,O_RDONLY | O_TEXT);
if (f>0) {
i1=(int)filelength(f);
ss=malloca(i1);
if (ss) {
i=read(f,ss,i1);
if (i>0) {
ss[i]=0;
line=strtok(ss,"\n");
handle_cps(line,s,s1);
}
farfree(ss);
}
close(f);
}
}
══[ Step 10 ]═════════════════════════════════════════════════════════════════
In FCNS.H, add the following two lines.
= void upload_files(char *fn, int dn, int type);
= int uploadall(int dn);
+ void handle_cps(char *l, char *s, char *s1);
+ void process_cps(char *s, char *s1);
=
=
= /* File: xfertmp.c */
══[ Step 11 ]═════════════════════════════════════════════════════════════════
Compile your source.
══[ Disclaimer ]══════════════════════════════════════════════════════════════
Don't complain to me if your board gets fried, your hard disk goes nuts, or
something terrible happens. The code in this mod should be harmless, but I
can't guarantee it will work for you. It works on my board.
JAFO 1@1 TerraNET
1@8857 IceNET
1@8861 WWIVnet
1@18857 WWIVLink
9
9 7───────────────────── 1Blue Thunder BBS 7─────────────────────
8 1TerraNET @1 7∙ 1IceNET @8857 7∙ 1WWIVnet @8861 7∙ 1WWIVLink @188680